package liquidfs.data;

import java.util.*;

import liquidfs.data.ex.*;
import liquidfs.data.ops.*;

public class Result<T> {

   private T data;
   private Set<PeerDevice> reached = new TreeSet<PeerDevice>();
     
   public Result (Operation<T> operation, T data) {
      this.reached.addAll(operation.getReachedDevices());
      this.data = data;
   }
   
   public void addReachedDevice (PeerDevice device) {
      this.reached.add(device);
   }
   
   public void addReachedDevices (Collection<PeerDevice> devices) {
      this.reached.addAll(devices);
   }
   
   public Set<PeerDevice> getReachedDevices () {
      return reached;
   }
   
   public T getData () throws FileSystemException {
      return this.data;
   }
   
}
